********************************************************************************
*  		       CLEANING THE ENDLINE TEACHER SURVEY			                   *
*===============================================================================
* Date created: 15th/02/2019												   *									   *
* Version : Stata 15                            							   *
* Descrption: This dofile is part of the cleaning activity of the endline      *
*             teacher survey. This particular do-file iterates/describes all   *
*             steps undertaken to clen this dataset  
*Output file: 03 Endline_Teacher_Survey_Final                          *
********************************************************************************


*************TEACHER SURVEY CORRECTIONS************
clear all
set more off
cd "[directory]"

use "Endline Teacher Survey Final.dta"


*SECTION 1. TEACHER AND SCHOOL IDENTIFICATION
*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*

*Dropping varibales having no information
drop subscriberid simid devicephonenum enumname_other

* 112
la var class_level_112_1 "In which levels/classes do you teach entrepreneurship course?"
la de class_level_112_1_s1 1 "Yes" 0 "No"
la values class_level_112_1 class_level_112_1_s1

la var class_level_112_2 "In which levels/classes do you teach entrepreneurship course?"
la de class_level_112_2_s2 1 "Yes" 0 "No"
la values class_level_112_2 class_level_112_2_s2

la var class_level_112_3 "In which levels/classes do you teach entrepreneurship course?"
la de class_level_112_3_s3 1 "Yes" 0 "No"
la values class_level_112_3 class_level_112_3_s3

la var class_level_112_4 "In which levels/classes do you teach entrepreneurship course?"
la de class_level_112_4_s4 1 "Yes" 0 "No"
la values class_level_112_4 class_level_112_4_s4

la var class_level_112_5 "In which levels/classes do you teach entrepreneurship course?"
la de class_level_112_5_s5 1 "Yes" 0 "No"
la values class_level_112_5 class_level_112_5_s5

la var class_level_112_6 "In which levels/classes do you teach entrepreneurship course?"
la de class_level_112_6_s6 1 "Yes" 0 "No"
la values class_level_112_6 class_level_112_6_s6

la var class_level_112_7 "In which levels/classes do you teach entrepreneurship course?"
la de class_level_112_7_notteach 1 "Yes" 0 "No"
la values class_level_112_7 class_level_112_7_notteach


**adding labels to  class_level_112: 112. In which levels/classes do you teach entrepreneurship course
notes class_level_112_1: 112. In which levels/classes do you teach entrepreneurship course
notes class_level_112_2: 112. In which levels/classes do you teach entrepreneurship course
notes class_level_112_3: 112. In which levels/classes do you teach entrepreneurship course
notes class_level_112_4: 112. In which levels/classes do you teach entrepreneurship course
notes class_level_112_5: 112. In which levels/classes do you teach entrepreneurship course
notes class_level_112_6: 112. In which levels/classes do you teach entrepreneurship course
notes class_level_112_7: 112. In which levels/classes do you teach entrepreneurship course

//these codes correct the baseline_122 varibles where observers recorded incorrect answer choices
replace baseline_112 = 0 if teacherid == 3010402
replace baseline_112 = 0 if teacherid == 3010422
replace baseline_112 = 0 if teacherid == 3011352
replace baseline_112 = 0 if teacherid == 3041032
replace baseline_112 = 0 if teacherid == 3041232
replace baseline_112 = 0 if teacherid == 3051352
replace baseline_112 = 0 if teacherid == 4010142
replace baseline_112 = 0 if teacherid == 4011192
replace baseline_112 = 0 if teacherid == 4021112
replace baseline_112 = 0 if teacherid == 4030502
replace baseline_112 = 0 if teacherid == 4031042
replace baseline_112 = 0 if teacherid == 4051022
replace baseline_112 = 0 if teacherid == 5030562
replace baseline_112 = 0 if teacherid == 5061012

*202
tostring teacherid, replace
replace year_start_202 = "0" if teacherid == "4021032"
replace year_start_202 = "0" if key == "uuid:15ebb74f-be54-41f5-a08f-c4f4d2ecf954"
destring year_start_202, replace


*SECTION 2. TEACHER EXPERIENCE AND TRAINING
*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*

*210
la var fromwhom_210_1 "From whom?"
la de fromwhom_210_1_reb 1 "Yes" 0 "No"
la values fromwhom_210_1 fromwhom_210_1_reb
 
 la var fromwhom_210_2 "From whom?"
la de fromwhom_210_2_educate 1 "Yes" 0 "No"
la values fromwhom_210_2 fromwhom_210_2_educate
 
 la var fromwhom_210_3 "From whom?"
la de fromwhom_210_3_reb_educate 1 "Yes" 0 "No"
la values fromwhom_210_3 fromwhom_210_3_reb_educate
 
 la var fromwhom_210_4 "From whom?"
la de fromwhom_210_4_other_NGO 1 "Yes" 0 "No"
la values fromwhom_210_4 fromwhom_210_4_other_NGO
 
drop _other_210

**adding notes to fromwhom_210: 210. From whom?
notes fromwhom_210_1: 210. From whom?
notes fromwhom_210_2: 210. From whom?
notes fromwhom_210_3: 210. From whom?
notes fromwhom_210_4: 210. From whom?

*213
la var fromwhom_213_1 "From whom?"
la de fromwhom_213_1_reb 1 "Yes" 0 "No"
la values fromwhom_213_1 fromwhom_213_1_reb
 
 la var fromwhom_213_2 "From whom?"
la de fromwhom_213_2_educate 1 "Yes" 0 "No"
la values fromwhom_213_2 fromwhom_213_2_educate
 
 la var fromwhom_213_3 "From whom?"
la de fromwhom_213_3_reb_educate 1 "Yes" 0 "No"
la values fromwhom_213_3 fromwhom_213_3_reb_educate
 
 la var fromwhom_213_4 "From whom?"
la de fromwhom_213_4_other_NGO 1 "Yes" 0 "No"
la values fromwhom_213_4 fromwhom_213_4_other_NGO
 
drop fromwhom_other_213

**adding notes to fromwhom_213: 213. From whom?
notes fromwhom_213_1: 213. From whom?
notes fromwhom_213_2: 213. From whom?
notes fromwhom_213_3: 213. From whom?
notes fromwhom_213_4: 213. From whom?


*215
la var fromwhom_215_1 "From whom?"
la de fromwhom_215_1_reb 1 "Yes" 0 "No"
la values fromwhom_215_1 fromwhom_215_1_reb
 
 la var fromwhom_215_2 "From whom?"
la de fromwhom_215_2_educate 1 "Yes" 0 "No"
la values fromwhom_215_2 fromwhom_215_2_educate
 
 la var fromwhom_215_3 "From whom?"
la de fromwhom_215_3_reb_educate 1 "Yes" 0 "No"
la values fromwhom_215_3 fromwhom_215_3_reb_educate
 
 la var fromwhom_215_4 "From whom?"
la de fromwhom_215_4_other_NGO 1 "Yes" 0 "No"
la values fromwhom_215_4 fromwhom_215_4_other_NGO
 
drop fromwhom_other_215

**adding notes to fromwhom_215: 215. From whom?
notes fromwhom_215_1: 215. From whom?
notes fromwhom_215_2: 215. From whom?
notes fromwhom_215_3: 215. From whom?
notes fromwhom_215_4: 215. From whom?


*SECTION 4. CURRICULAR KNOWLEDGE AND PERCEPTIONS 
*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*

*404
replace hours_entr_404 = "6" if key == "uuid:7973a80b-ead5-49c9-89d3-5da50812b1fc"
replace hours_entr_404 = "6" if key == "uuid:a58885eb-6407-4de6-9b60-ca60f2a06635"
replace hours_entr_404 = "6" if key == "uuid:e6f12af4-2d91-47e8-9f10-cab79c9adc16"
replace hours_entr_404 = "6" if key == "uuid:5211cc71-9c13-4099-8414-654ee225df28"
replace hours_entr_404 = "6" if key == "uuid:fe5e8c28-a8f0-452a-807f-64345a34ec1c"
replace hours_entr_404 = "6" if key == "uuid:dfb71c03-2a80-405a-865a-5e6bf091db62"
replace hours_entr_404 = "6" if key == "uuid:c9b78ec8-4ff5-4b85-a618-422e690aa1f4"
replace hours_entr_404 = "6" if key == "uuid:f8c43fad-d9b2-4306-aec4-9f4da7f3ec97"
replace hours_entr_404 = "6" if key == "uuid:5af82524-3633-49af-afe3-2d7f1b7b73ec"
replace hours_entr_404 = "6" if key == "uuid:5ca49ee0-dc32-42d4-b781-7ec3d0b6f2cd"
replace hours_entr_404 = "6" if key == "uuid:f38ae642-6f6e-416a-99a5-124fc0bbb1dd"
destring hours_entr_404, replace


*413
la var appl_skillslab_stu_413_1 "How should students apply marketing skills in their school business club?"
la de appl_skillslab_stu_413_1_lab 1 "Yes" 0 "No"
la values appl_skillslab_stu_413_1 appl_skillslab_stu_413_1_lab
 
la var appl_skillslab_stu_413_2 "How should students apply marketing skills in their school business club?"
la de appl_skillslab_stu_413_2_lab 1 "Yes" 0 "No"
la values appl_skillslab_stu_413_2 appl_skillslab_stu_413_2_lab
 
la var appl_skillslab_stu_413_3 "How should students apply marketing skills in their school business club?"
la de appl_skillslab_stu_413_3_lab 1 "Yes" 0 "No"
la values appl_skillslab_stu_413_3 appl_skillslab_stu_413_3_lab

la var appl_skillslab_stu_413_4 "How should students apply marketing skills in their school business club?"
la de appl_skillslab_stu_413_4_lab 1 "Yes" 0 "No"
la values appl_skillslab_stu_413_4 appl_skillslab_stu_413_4_lab
 
la var appl_skillslab_stu_413_5 "How should students apply marketing skills in their school business club?"
la de appl_skillslab_stu_413_5_lab 1 "Yes" 0 "No"
la values appl_skillslab_stu_413_5 appl_skillslab_stu_413_5_lab
 
la var appl_skillslab_stu_413_6 "How should students apply marketing skills in their school business club?"
la de appl_skillslab_stu_413_6_lab 1 "Yes" 0 "No"
la values appl_skillslab_stu_413_6 appl_skillslab_stu_413_6_lab

destring appl_skillslab_stu_413_other, replace
la var appl_skillslab_stu_413_other "How should students apply marketing skills in their school business club?"
la de appl_skillslab_stu_413_other 1 "Yes" 0 "No"
la values appl_skillslab_stu_413_other appl_skillslab_stu_413_other

rename v104 appl_skillab_stu_413_spec_oth

**adding notes on appl_skillslab_stu_413 : 413. How should students apply marketing skills in their school business club?
notes appl_skillslab_stu_413_1: 413. How should students apply marketing skills in their school business club?
notes appl_skillslab_stu_413_2: 413. How should students apply marketing skills in their school business club?
notes appl_skillslab_stu_413_3: 413. How should students apply marketing skills in their school business club?
notes appl_skillslab_stu_413_4: 413. How should students apply marketing skills in their school business club?
notes appl_skillslab_stu_413_5: 413. How should students apply marketing skills in their school business club?
notes appl_skillslab_stu_413_6: 413. How should students apply marketing skills in their school business club?



*414
la var incl_bus_plan_414_1 "What should be included in a student’s business plan?"
la de incl_bus_plan_414_1_lab 1 "Yes" 0 "No"
la values incl_bus_plan_414_1 incl_bus_plan_414_1_lab

la var incl_bus_plan_414_2 "What should be included in a student’s business plan?"
la de incl_bus_plan_414_2_lab 1 "Yes" 0 "No"
la values incl_bus_plan_414_2 incl_bus_plan_414_2_lab

la var incl_bus_plan_414_3 "What should be included in a student’s business plan?"
la de incl_bus_plan_414_3_lab 1 "Yes" 0 "No"
la values incl_bus_plan_414_3 incl_bus_plan_414_3_lab

la var incl_bus_plan_414_4 "What should be included in a student’s business plan?"
la de incl_bus_plan_414_4_lab 1 "Yes" 0 "No"
la values incl_bus_plan_414_4 incl_bus_plan_414_4_lab

la var incl_bus_plan_414_5 "What should be included in a student’s business plan?"
la de incl_bus_plan_414_5_lab 1 "Yes" 0 "No"
la values incl_bus_plan_414_5 incl_bus_plan_414_5_lab

la var incl_bus_plan_414_6 "What should be included in a student’s business plan?"
la de incl_bus_plan_414_6_lab 1 "Yes" 0 "No"
la values incl_bus_plan_414_6 incl_bus_plan_414_6_lab

destring incl_bus_plan_414_other, replace
la var incl_bus_plan_414_other "What should be included in a student’s business plan?"
la de incl_bus_plan_414_other 1 "Yes" 0 "No"
la values incl_bus_plan_414_other incl_bus_plan_414_other

rename v113 incl_bus_plan_414_spec_other

notes incl_bus_plan_414_1: 414. What should be included in a student’s business plan?
notes incl_bus_plan_414_2: 414. What should be included in a student’s business plan?
notes incl_bus_plan_414_3: 414. What should be included in a student’s business plan?
notes incl_bus_plan_414_4: 414. What should be included in a student’s business plan?
notes incl_bus_plan_414_5: 414. What should be included in a student’s business plan?
notes incl_bus_plan_414_6: 414. What should be included in a student’s business plan?

*415
la var balenc_sheet_415_1 "415. What are the main components of a balance sheet?"
la de balenc_sheet_415_1_lab 1 "Yes" 0 "No"
la values balenc_sheet_415_1 balenc_sheet_415_1_lab

la var balenc_sheet_415_2 "415. What are the main components of a balance sheet?"
la de balenc_sheet_415_2_lab 1 "Yes" 0 "No"
la values balenc_sheet_415_2 balenc_sheet_415_2_lab

la var balenc_sheet_415_3 "415. What are the main components of a balance sheet?"
la de balenc_sheet_415_3_lab 1 "Yes" 0 "No"
la values balenc_sheet_415_3 balenc_sheet_415_3_lab

la var balenc_sheet_415_4 "415. What are the main components of a balance sheet?"
la de balenc_sheet_415_4_lab 1 "Yes" 0 "No"
la values balenc_sheet_415_4 balenc_sheet_415_4_lab

la var balenc_sheet_415_5 "415. What are the main components of a balance sheet?"
la de balenc_sheet_415_5_lab 1 "Yes" 0 "No"
la values balenc_sheet_415_5 balenc_sheet_415_5_lab

la var balenc_sheet_415_6 "415. What are the main components of a balance sheet?"
la de balenc_sheet_415_6_lab 1 "Yes" 0 "No"
la values balenc_sheet_415_6 balenc_sheet_415_6_lab

la var balenc_sheet_415_7 "415. What are the main components of a balance sheet?"
la de balenc_sheet_415_7_lab 1 "Yes" 0 "No"
la values balenc_sheet_415_7 balenc_sheet_415_7_lab

**adding notes on balenc_sheet_415 : 415. What are the main components of a balance sheet?
notes balenc_sheet_415_1: 415. What are the main components of a balance sheet?
notes balenc_sheet_415_2: 415. What are the main components of a balance sheet?
notes balenc_sheet_415_3: 415. What are the main components of a balance sheet?
notes balenc_sheet_415_4: 415. What are the main components of a balance sheet?
notes balenc_sheet_415_5: 415. What are the main components of a balance sheet?
notes balenc_sheet_415_6: 415. What are the main components of a balance sheet?
notes balenc_sheet_415_7: 415. What are the main components of a balance sheet?


*425
la var teach_method_425_1 "What are the teaching methods or pedagogies that you are most comfortable using? Please rank them"
la de teach_method_425_1_lab 1 "Yes" 0 "No"
la values teach_method_425_1 teach_method_425_1_lab

la var teach_method_425_2 "What are the teaching methods or pedagogies that you are most comfortable using? Please rank them"
la de teach_method_425_2_lab 1 "Yes" 0 "No"
la values teach_method_425_2 teach_method_425_2_lab

la var teach_method_425_3 "What are the teaching methods or pedagogies that you are most comfortable using? Please rank them"
la de teach_method_425_3_lab 1 "Yes" 0 "No"
la values teach_method_425_3 teach_method_425_3_lab

la var teach_method_425_4 "What are the teaching methods or pedagogies that you are most comfortable using? Please rank them"
la de teach_method_425_4_lab 1 "Yes" 0 "No"
la values teach_method_425_4 teach_method_425_4_lab

la var teach_method_425_5 "What are the teaching methods or pedagogies that you are most comfortable using? Please rank them"
la de teach_method_425_5_lab 1 "Yes" 0 "No"
la values teach_method_425_5 teach_method_425_5_lab

la var teach_method_425_6 "What are the teaching methods or pedagogies that you are most comfortable using? Please rank them"
la de teach_method_425_6_lab 1 "Yes" 0 "No"
la values teach_method_425_6 teach_method_425_6_lab

la var teach_method_425_7 "What are the teaching methods or pedagogies that you are most comfortable using? Please rank them"
la de teach_method_425_7_lab 1 "Yes" 0 "No"
la values teach_method_425_7 teach_method_425_7_lab

la var teach_method_425_8 "What are the teaching methods or pedagogies that you are most comfortable using? Please rank them"
la de teach_method_425_8_lab 1 "Yes" 0 "No"
la values teach_method_425_8 teach_method_425_8_lab

la var teach_method_425_9 "What are the teaching methods or pedagogies that you are most comfortable using? Please rank them"
la de teach_method_425_9_lab 1 "Yes" 0 "No"
la values teach_method_425_9 teach_method_425_9_lab

la var teach_method_425_10 "What are the teaching methods or pedagogies that you are most comfortable using? Please rank them"
la de teach_method_425_10_lab 1 "Yes" 0 "No"
la values teach_method_425_10 teach_method_425_10_lab

la var teach_method_425_11 "What are the teaching methods or pedagogies that you are most comfortable using? Please rank them"
la de teach_method_425_11_lab 1 "Yes" 0 "No"
la values teach_method_425_11 teach_method_425_11_lab

**adding notes on teach_method_425: 424. What are the teaching methods or pedagogies that you are most comfortable u
notes teach_method_425_1: 424. What are the teaching methods or pedagogies that you are most comfortable u
notes teach_method_425_2: 424. What are the teaching methods or pedagogies that you are most comfortable u
notes teach_method_425_3: 424. What are the teaching methods or pedagogies that you are most comfortable u
notes teach_method_425_4: 424. What are the teaching methods or pedagogies that you are most comfortable u
notes teach_method_425_5: 424. What are the teaching methods or pedagogies that you are most comfortable u
notes teach_method_425_6: 424. What are the teaching methods or pedagogies that you are most comfortable u
notes teach_method_425_7: 424. What are the teaching methods or pedagogies that you are most comfortable u
notes teach_method_425_8: 424. What are the teaching methods or pedagogies that you are most comfortable u
notes teach_method_425_9: 424. What are the teaching methods or pedagogies that you are most comfortable u
notes teach_method_425_10: 424. What are the teaching methods or pedagogies that you are most comfortable u
notes teach_method_425_11: 424. What are the teaching methods or pedagogies that you are most comfortable u


*SECTION 5. TEACHER AND JOB SATISFACTION 
*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*

*501
replace hrsothoccup_501 = "5" if key == "uuid:5409e734-d70b-4c3d-ac23-bf08ae50060e"
replace hrsothoccup_501 = "5" if key == "uuid:4fa4ac8a-1325-4bba-8108-cffb2bd39299"
replace hrsothoccup_501 = "4" if key == "uuid:796e05f1-86bd-4055-aa85-0b4132da74a2"
replace hrsothoccup_501 = "0" if key == "uuid:ea28017d-2346-4a32-84b1-3ae1cd37d2db"
replace hrsothoccup_501 = "5" if key == "uuid:ab08f39a-7ed9-49c0-875d-ac4bd521f85e"
replace hrsothoccup_501 = "8" if key == "uuid:9621c057-d5b0-49f1-a462-728f680e8ec4"
replace hrsothoccup_501 = "14" if key == "uuid:1d0fd80a-6fcd-4396-a0b2-2569f5f4a24a"
replace hrsothoccup_501 = "10" if key == "uuid:3739951e-cacb-40b4-ab2a-5d7c5f4382b5"
replace hrsothoccup_501 = "1" if key == "uuid:507f044b-b165-4686-aa1a-3e1275410b33"
replace hrsothoccup_501 = "8" if key == "uuid:2f00d86a-b614-45e6-a862-5bac65a554ad"
replace hrsothoccup_501 = "12" if key == "uuid:9a3ab14e-a6d6-4440-8b09-30060bd8822d"
replace hrsothoccup_501 = "8" if key == "uuid:47480abb-1d63-4433-bbcc-706ddefe2244"
replace hrsothoccup_501 = "7" if key == "uuid:99a03f23-b8de-44cb-ab68-1b7ee2f59fbb"
replace hrsothoccup_501 = "8" if key == "uuid:a253732c-1eaf-4747-839e-3f1138d24876"
replace hrsothoccup_501 = "6" if key ==  "uuid:fedeb931-44b6-4848-9a7a-99b69b80fa19"
replace hrsothoccup_501 = "4" if key == "uuid:796e05f1-86bd-4055-aa85-0b4132da74a2"
replace hrsothoccup_501 = "" if key == "uuid:ea28017d-2346-4a32-84b1-3ae1cd37d2db"
replace hrsothoccup_501 = "5" if key == "uuid:ab08f39a-7ed9-49c0-875d-ac4bd521f85e"
replace hrsothoccup_501 = "5" if key == "uuid:5409e734-d70b-4c3d-ac23-bf08ae50060e"
replace hrsothoccup_501 = "5" if key == "uuid:4fa4ac8a-1325-4bba-8108-cffb2bd39299"

destring hrsothoccup_501, replace

destring teacherid, replace

destring age_200, replace


**Cleanimg duplicate IDs

drop if teacherid == 4051241 & key == "uuid:7927de04-15fb-498f-ac43-3ad45289bc6d"

replace teacherid = 4051173 if key == "uuid:db96a1d6-80d8-4c94-b06a-09f5e15f7d65"
replace reenter_teacherid = 4051173 if key == "uuid:db96a1d6-80d8-4c94-b06a-09f5e15f7d65"

replace teacherid = 4051172 if key == "uuid:56ee923c-14e7-4d48-9a1d-af1ef6d5718e"
replace reenter_teacherid = 4051172 if key == "uuid:56ee923c-14e7-4d48-9a1d-af1ef6d5718e"

replace teacherid = 5071183 if key == "uuid:a2e79405-b9f7-4666-8ffc-76b2853c2f24"
replace reenter_teacherid = 5071183 if key == "uuid:a2e79405-b9f7-4666-8ffc-76b2853c2f24"

replace teacherid = 5071182 if key == "uuid:d72642bc-bb54-4516-ae21-56946f804148"
replace reenter_teacherid = 5071182 if key == "uuid:d72642bc-bb54-4516-ae21-56946f804148"


replace teacherid = 5071231 if key == "uuid:616cbfdc-3229-4c6c-b21f-19c119b53dce"
replace reenter_teacherid = 5071231 if key == "uuid:616cbfdc-3229-4c6c-b21f-19c119b53dce"

replace teacherid = 5071232 if key == "uuid:e1c9b398-06db-4f44-af17-834e54f011c6"
replace reenter_teacherid = 5071232 if key == "uuid:e1c9b398-06db-4f44-af17-834e54f011c6"



**other ID cleanings 

destring hrsothoccup_501, replace

replace schoolid = 403031 if schoolid == 4021161
replace reenter_schoolid = 403031 if reenter_schoolid == 4021161

replace schoolid = 402116 if schoolid == 4030312
replace reenter_schoolid = 402116 if reenter_schoolid == 4030312

replace teacherid = 4031042 if key == "uuid:67ab82b3-e492-4bf8-b4fa-00785fe9b113"
replace reenter_teacherid = 4031042 if key == "uuid:67ab82b3-e492-4bf8-b4fa-00785fe9b113"

**GS Juru Kayonza
replace schoolid = 504102 if schoolid == 5041021
replace reenter_schoolid = 504102 if reenter_schoolid == 5041021


**GS Muko II
replace schoolid = 504108 if schoolid == 5041081
replace reenter_schoolid = 504108 if reenter_schoolid == 5041081

**GS Zaza A
replace schoolid = 506118 if schoolid == 605118
replace reenter_schoolid = 506118 if reenter_schoolid == 605118

**GS Gasange
replace schoolid = 503104 if schoolid == 503204
replace reenter_schoolid = 503104 if reenter_schoolid == 503204

**GS Gihengeri
replace schoolid = 503107 if schoolid == 5033107
replace reenter_schoolid = 503107 if reenter_schoolid == 5033107

**GS Masoro//correcting the teacherid that was mistakenly created and entered at endline 
replace teacherid = 4011261 if key == "uuid:ea28017d-2346-4a32-84b1-3ae1cd37d2db"
replace reenter_teacherid = 4011261 if key == "uuid:ea28017d-2346-4a32-84b1-3ae1cd37d2db"



*********************************
tostring schoolid, replace
*drop if schoolid == "605118" & key == "uuid:45d59c0e-4017-433c-b65e-d9d033f4f376"
gen myidstr = "0" + schoolid
merge m:m myidstr using "t_addedbasinfo.dta"
drop if _merge == 2
drop _merge
rename myidstr schoolid_bas
*order province district sector cell village school schoolid_bas distrloc_106 publ_priv_108 board_day_109 group_110, after(reenter_schoolid)
order schoolid_bas, after(reenter_schoolid)



drop province_100 district_101 sector_102 cell_103 village_104

rename (bl_province_100 bl_district_101 bl_sector_102 bl_cell_103 bl_village_104)(province_100 district_101 sector_102 cell_103 village_104)
drop school_105 
rename (bl_distrloc_105 bl_school_name_106 bl_publ_priv_108 bl_group_111) (distrloc_105 school_name_106 publ_priv_108 group_111)

order province_100 district_101 sector_102 cell_103 village_104 distrloc_105 school_name_106 publ_priv_108 group_111, after(schoolid_bas)

la de group_111 1 "Treatment" 2 "Control", modify




save "03 Endline_Teacher_Survey_Final", replace
